#include "Generate_C_std.h"
#include "Pattern_assign_var.h"

class Pattern_assign_expr_unary_op : public Pattern_assign_var
{
public:
	Expr* rhs_pattern()
	{
		op = new Wildcard<OP>;
		rhs = new Wildcard<VARIABLE_NAME>;

		return new Unary_op(op, rhs);
	}

	void generate_code (Generate_C* gen)
	{
		assert (!agn->is_ref);
		assert (op_functions.has (*op->value->value));

		string op_fn = op_functions[*op->value->value]; 

		INST (buf, "assign_expr_unary_op",
				lhs->value, rhs->value, s(op_fn));
	}

protected:
	Wildcard<OP>* op;
	Wildcard<VARIABLE_NAME>* rhs;
};


CREATE(Pattern_assign_expr_unary_op);
